<!DOCTYPE html>
<html lang="en">
<head>
    <title>{$title_befor|default=""}</title>

    <meta charset="UTF-8">
    <title>user_manage</title>
    <link rel="stylesheet" type="text/css" href="{$empt_var|getTemplPath}/Public/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="{$empt_var|getTemplPath}/Public/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="{$empt_var|getTemplPath}/Public/viewerjs/viewer.css">

    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/easyui/locale/easyui-lang-zh_CN.js"></script>

    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/commjs/common-lib.js"></script>
    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/commjs/jquery.liMarquee.js"></script>
    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/commjs/jquery.sitebar-1.0.js"></script>

    <link href="{$empt_var|getTemplPath}/Public/commcss/liMarquee.css" rel="stylesheet">
    <link href="{$empt_var|getTemplPath}/Public/commcss/jquery.sitebar.css" rel="stylesheet">

    <style type="text/css">
        body, html {
            font-family: "Microsoft YaHei", "微软雅黑";
        }

        /*.pagination-info {*/
        /*float: left;*/
        /*padding-left: 120px;*/
        /*}*/

        /*-------------------------*/
        .pictures {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .pictures > li {
            float: left;
            /*width: 20%;*/
            /*height: 33.3%;*/
            margin: 0 1px 1px 0;
            border: 1px solid transparent;
            overflow: hidden;
        }

        .pictures > li > img {
            /*width: 100%;*/
            width: 210px;
            height: 297px;
            margin-left: 0px;
            margin-top: -1.66667px;
            cursor: -webkit-zoom-in;
            cursor: zoom-in;
        }
    </style>

    <script type="text/javascript">
        const SPSTR_1 = "sp1fsp1";
        const SPSTR_2 = "sp2fsp2";
        // const FILE_SPSTR_1 = "spdotsp";

        var g_gclb_row_index = 0;
        var g_jsxyyl_row_index = -1;
        var g_cr_data = "";
        var g_viewer_list = [];

        var g_$notice_info;
    </script>
</head>

<body style="border: 0px solid; border-color: #FF0000; background-color: #FFFFFF; margin: 0px; padding: 7px 7px 0px 7px;">

<div style="margin:0 auto; padding: 5px; border: 0px solid; border-color: #FF0000; width: 980px;">
    <div class="easyui-panel" fit="true" style="width:100%; height:45px; padding:10px;">
        <span style="float: left; font-size: 18px; font-weight: 900;">工程管理</span>
        <span id="top_dis_panel_1" style="float: left; margin-top: 7px; margin-left: 15px; color: #0000FF;font-size: 9px; font-weight: 900;"></span>
        <span id="top_dis_panel_gcname" style="float: left; margin-left: 15px; color: #0000FF; font-size: 18px; font-weight: 900; display: none;"></span>

        <if condition="$login_flag eq 0">
            <script type="text/javascript">
                $(function ()
                {
                    $("#top_dis_panel_1").text("登录后双击条目浏览工程详细信息");
                });
            </script>
        </if>

        <if condition="$login_flag eq 1">
            <script type="text/javascript">
                $(function ()
                {
                    $("#top_dis_panel_1").text("双击条目浏览工程详细信息");
                });
            </script>
        </if>

        <script type="text/javascript">
            function get_notice(disFlag)
            {
                var notice = "";
                var notice_update_datetime = "";

                $.ajax({
                    type: "POST",
                    url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/loadNotice",
                    data: {disFlag: disFlag},
                    async: false,
                    success: function (data_obj)
                    {
                        notice = data_obj.notice;
                        notice_update_datetime = data_obj.notice_update_datetime;
                    }
                });

                return {
                    notice: notice,
                    notice_update_datetime: notice_update_datetime
                };
            }
        </script>

        <if condition="$gc_manage_auth eq 1"></if>
        <script type="text/javascript">
            function save_notice()
            {
                $('#manage_notice_fm').form("submit", {
                    url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/saveNotice",
                    onSubmit: function ()
                    {
                        return true;
                    },
                    success: function (result)
                    {
                        dis_notice();
                        $("#manage_notice_dlg").dialog("close");
                    }
                });
            }

            function disk_notice_dlg()
            {
                $("#manage_notice_dlg").form("clear");
                $("#notice_text").textbox("setValue", get_notice(0).notice);
                $('#manage_notice_dlg').dialog('open').dialog('center').dialog('setTitle', '交流信息管理');
                $('#notice_text').next('span').find('textarea').focus();
            }
        </script>

        <style type="text/css">
            #top_dis_panel_2, #top_dis_panel_3 {
                float: left;
                margin-top: 7px;
                margin-left: 15px;
                color: #FF0000;
                font-size: 9px;
                font-weight: 900;
                text-decoration: none;
            }
        </style>
        <a id="top_dis_panel_2" href="javascript:void(0)" onclick="disk_notice_dlg()">
            交流信息（点击管理及查看）
        </a>
        <span id="top_dis_panel_3" style="margin-left: 0px; color: #000000;">
        </span>

        <script type="text/javascript">
            function login()
            {
                if (trim($("#login-btn").text()) == "登录")
                {
                    $("#login_dlg").form("clear");
                    $("#login_dispanel").html("登录您的账号　（与虚拟机账号一致）");
                    $("#login_dlg").dialog("open").dialog("center").dialog("setTitle", "登录");
                    $('#user_name').next('span').find('input').focus();
                }

                if (trim($("#login-btn").text()) == "退出")
                {
                    $.ajax({
                        type: "POST",
                        url: "{:APP_ROOT}/MkUser/Login/logout",
                        success: function (data)
                        {
                            location.href = "{:APP_ROOT}{:DEF_MODULE}";
                        }
                    });
                }
            }

            function login_pro()
            {
                $("#user_name").textbox("setValue", trim($("#user_name").textbox("getValue")));
                $('#login_fm').form("submit", {
                    url: "{:APP_ROOT}/MkUser/Login/login",
                    onSubmit: function ()
                    {
                        //客户端校验
                        return true;
                    },
                    success: function (result)
                    {
                        //服务端校验
                        data_obj = eval("(" + result + ")");

                        if (data_obj.success == 0)
                        {
                            $.messager.alert("消息", data_obj.info, "warning");
                        }
                        else if (data_obj.success == 1)
                        {
                            $('#login_dlg').dialog("close");
                            location.href = "{:APP_ROOT}{:DEF_MODULE}";
                            //$("#login-btn").text("退出");
                        }
                    }
                });
            }
        </script>

        <span style="float: right; margin-top: 3px; margin-right: 8px;">
            <a id="login-btn" href="javascript:void(0)" style="font-size: 16px; font-weight: 600; text-decoration: none;" onclick="login()">
                <if condition="$login_flag eq 0">
                    登录
                <elseif condition="$login_flag eq 1"/>
                    退出
                </if>
            </a>
        </span>

        <span style="float: right; margin-top: 3px; margin-right: 10px">
            <span id="login-disname" href="javascript:void(0)" style="vertical-align: bottom; font-size: 16px; font-weight: 600; color: #0000FF;">
                {$dis_name|default=""}
            </span>
        </span>

    </div>
</div>

<!---->
<div id="gc_detail" style="display: none; margin:0 auto; padding: 5px; border: 0px solid; border-color: #FF0000; width: 980px;">
    <div class="easyui-panel" style="width:100%; padding:10px; fit:true;">
        <div style="margin-bottom: 6px; padding-bottom: 2px; font-size: 12px; border-bottom: 1px solid #ccc;">
            <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-back'" plain="true" onclick="goBack()">返回</a>
        </div>

        <script type="text/javascript">
            function saveGcDetailData(msgFlag)
            {
                //保存工程详细信息

                //信息列表
                var rows_data = {};
                var rows = $('#gc_detail_propertygrid').datagrid('getData').rows;
                //console.log(rows);
                for (var i = 0; i < rows.length; i++)
                {
                    rows_data[rows[i]["field"]] = rows[i]["value"];
                }
                //工程备注
                rows_data["bz"] = $("#bz").textbox("getValue");

                //付款方式
                var fg_str1 = "sp1fsp1";
                var fg_str2 = "sp2fsp2";
                var fkfs_val = "";
                var rows = $('#datagrid_fkfs').datagrid('getData').rows;
                for (var i = 0; i < rows.length; i++)
                {
                    var fg_str;
                    if (i == 0)
                        fg_str = "";
                    else
                        fg_str = fg_str1;
                    fkfs_val = fkfs_val + fg_str + (rows[i]["kx"] + fg_str2 + rows[i]["fk_bl"] + fg_str2 + rows[i]["fk_je"]);
                }
                rows_data["fkfs"] = fkfs_val;

                //保存
                $.ajax({
                    type: "POST",
                    url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/saveGcDetailData",
                    data: {id: g_gclb_row_index, data: rows_data},
                    async: false,
                    success: function (data_obj)
                    {
                        if (msgFlag == 1)
                            $.messager.alert("消息", "保存完成", "info");
                    }
                });
            }
        </script>

        <style type="text/css">
            div.panel-body > span.textbox {
                border: 0;
            }
        </style>

        <if condition="$gc_manage_auth eq 1">
            <div style="overflow: hidden;">
                <div style="margin-bottom: 3px">
                    <span style="font-size: 14px;font-weight: 600">工程详细信息</span> &nbsp;
                    <a href="javascript:void(0)" style="font-size: 14px;font-weight: 600; text-decoration: none;" onclick="saveGcDetailData(1)">保存</a>
                </div>
                <div style="float: left; width:300px; margin-right: 5px;">
                    <!--信息列表-->
                    <div style="margin-bottom: 5px;">
                        <table id="gc_detail_propertygrid" class="easyui-propertygrid" style="width:100%; height: 310px;">
                        </table>
                    </div>

                    <!--title="备注&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)' style='text-decoration: none;' onclick='saveGcDetailData(1)'>保存</a>"-->
                    <div class="easyui-panel" title="备注" style="width:100%; height:90px;">
                        <input id="bz" name="bz" class="easyui-textbox" data-options="multiline:true" style="height:61px; width:298px;">
                    </div>
                </div>
                <div style="float: left; width: 653px;">
                    <!--付款方式-->
                    <div style="margin-bottom: 5px;">
                        <table id="datagrid_fkfs" style="width: 100%; height: 160px;">
                        </table>
                    </div>
                    <!--付款进度-->
                    <div>
                        <table id="datagrid_fkjd" style="width: 100%; height: 256px;">
                        </table>
                    </div>
                </div>
            </div>
        </if>

        <script type="text/javascript">
            function showUpdatePanel(fl)
            {
                if ($("#update_file_" + fl).is(':hidden'))
                {
                    $("#dis_panel_" + fl).text("收起");
                    $("#update_file_" + fl).show();

                    if (fl == "gcsj")
                        $('#gcsj_qk_panel').panel({width: 651, height: 322});
                }
                else
                {
                    $("#dis_panel_" + fl).text("上传");
                    $("#update_file_" + fl).hide();

                    if (fl == "gcsj")
                        $('#gcsj_qk_panel').panel({width: 671, height: 322});
                }
            }

            function showDelPanel(fl, selfobj)
            {
                var idStr = "#galley_" + fl + "_ul" + " > li > div";

                if (trim($(selfobj).text()) == "删除")
                {
                    $(selfobj).text("收起");
                    $(idStr).show();
                }
                else
                {
                    $(selfobj).text("删除");
                    $(idStr).hide();
                }
                $("#galley_" + fl + "_panel").scrollTop(0);
            }
        </script>

        <!--==================================================-->
        <br/>
        <div id="gcqk_tabs" class="easyui-tabs" style="width: 958px; height:385px;">
            <div title="工程设计情况" style="padding: 5px">
                <if condition="($gc_manage_auth eq 1) or ($gcsj_manage_auth eq 1)">
                    <div id="dis_panel_save_gcsj" style="margin-left: 5px;">
                        <a href="javascript:void(0)" style="line-height: 22px; height: 22px; font-size: 14px; font-weight: 600; text-decoration: none;" onclick="updateGcJc(1)">
                            保存
                        </a>
                        &nbsp;
                        <a id="dis_panel_gcsj" href="javascript:void(0)" style="line-height: 22px; height: 22px; font-size: 14px; font-weight: 600; text-decoration: none;" onclick="showUpdatePanel('gcsj')">
                            上传
                        </a>
                        &nbsp;
                        <if condition="$gc_manage_auth eq 1">
                            <a id="dis_del_gcsj" href="javascript:void(0)" style="line-height: 22px; height: 22px; font-size: 14px; font-weight: 600; text-decoration: none;" onclick="delGcFile()">
                                删除
                            </a>
                        </if>
                    </div>
                </if>

                <if condition="($gc_manage_auth eq 1) or ($gcsj_manage_auth eq 1)">
                    <div id="update_file_gcsj" style="display: none; margin-bottom: 5px">
                        <form>
                            <div>
                                <input id="select_files_gcsj" type="file" name="photo" multiple="multiple"/>
                            </div>
                        </form>
                        <button style="margin-top: 5px" onclick="updateFileFront('gcsj')">文件上传</button>
                    </div>
                </if>

                <div style="overflow: hidden;">
                    <div style="float:left;  margin-right: 5px">
                        <div id="gcsj_qk_panel" class="easyui-panel" style="height:322px; width:671px;">
                            <input id="sj_qk" name="sj_qk" class="easyui-textbox" data-options="multiline:true" style="height: 100%; width:100%;">
                        </div>
                    </div>
                    <div style="float:left;">
                        <table id="datagrid_gcwj" style="height:322px; width:270px;">
                        </table>
                    </div>
                </div>
            </div>

            <div title="车间生产情况" style="padding: 5px">
                <if condition="($gc_manage_auth eq 1) or ($gcjg_manage_auth eq 1)">
                    <div id="dis_panel_save_gcjg" style="margin-left: 5px;">
                        <a href="javascript:void(0)" style="line-height: 22px; height: 22px; font-size: 14px;font-weight: 600; text-decoration: none;" onclick="updateGcJc(3)">保存</a>
                    </div>
                </if>
                <div id="gcjg_qk_panel" class="easyui-panel" style="height:321px; width:946px;">
                    <input id="cj_qk" name="cj_qk" class="easyui-textbox" data-options="multiline:true" style="height: 100%; width:100%;">
                </div>
            </div>

            <div title="采购调试情况" style="padding: 5px">
                <if condition="($gc_manage_auth eq 1) or ($gccg_manage_auth eq 1)">
                    <div id="dis_panel_save_gccg" style="margin-left: 5px;">
                        <a href="javascript:void(0)" style="line-height: 22px; height: 22px; font-size: 14px;font-weight: 600; text-decoration: none;" onclick="updateGcJc(2)">保存</a>
                    </div>
                </if>
                <div id="gccg_qk_panel" class="easyui-panel" style="height:321px; width:946px;">
                    <input id="cg_qk" name="cg_qk" class="easyui-textbox" data-options="multiline:true" style="height: 100%; width:100%;">
                </div>
            </div>
        </div>

        <script type="text/javascript">
            $(function ()
            {
                //元素判断, Panel Datagrid Resize
                if ($("#dis_panel_save_gcsj").length == 0)
                {
                    $("#gcsj_qk_panel").panel({
                        width: $("#gcsj_qk_panel").width() + 2,
                        height: $("#gcsj_qk_panel").height() + 22 + 2
                    });
                    $("#datagrid_gcwj").height($("#datagrid_gcwj").height() + 22);
                }

                var dis_panel_list = ["gccg", "gcjg"];
                for (var k in dis_panel_list)
                {
                    if ($("#dis_panel_save_" + dis_panel_list[k]).length == 0)
                    {
                        $("#" + dis_panel_list[k] + "_qk_panel").panel({
                            width: $("#" + dis_panel_list[k] + "_qk_panel").width() + 2,
                            height: $("#" + dis_panel_list[k] + "_qk_panel").height() + 22 + 3
                        });
                    }
                }
            });
        </script>

        <!--==================================================-->
        <br/>
        <div id="sp_tabs" class="easyui-tabs" style="width: 958px; height:385px;">
        </div>

        <div id="sp_tpl" style="display: none;">
            <div style="padding: 5px 0px 5px 5px;">
                <div style="margin-left: 5px; margin-bottom: 3px;">
                    <if condition="$gc_manage_auth eq 1">
                        <a id="dis_panel_ht" href="javascript:void(0)" style="font-size: 14px; font-weight: 600; text-decoration: none;" onclick="showUpdatePanel('ht')">
                            上传
                        </a>
                        &nbsp;
                        <a id="dis_panel_ht_del" href="javascript:void(0)" style="font-size: 14px; font-weight: 600; text-decoration: none;" onclick="showDelPanel('ht',this)">
                            删除
                        </a>
                        &nbsp;
                        <a id="dis_panel_ht_delall" href="javascript:void(0)" style="font-size: 14px; font-weight: 600; text-decoration: none;" onclick="delAllPic('ht')">
                            全部清空
                        </a>
                        &nbsp;
                    </if>
                    <a href="javascript:void(0)" style="font-size: 14px; font-weight: 600; text-decoration: none;" onclick="downloadAllPic(-1,'ht')">
                        全部下载
                    </a>
                </div>

                <if condition="$gc_manage_auth eq 1">
                    <div id="update_file_ht" style="display: none; margin-bottom: 5px">
                        <form>
                            <div>
                                <input id="select_files_ht" type="file" name="photo" multiple="multiple"/>
                            </div>
                        </form>
                        <button style="margin-top: 5px" onclick="updateFileFront('ht')">文件上传</button>
                    </div>
                </if>

                <div id="galley_ht_panel" class="easyui-panel" style="width:946px; height:304px; padding:2px;">
                    <div id="galley_ht" style="width:50000px;">
                        <ul id="galley_ht_ul" class="pictures">
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="gc_main" style="margin:0 auto; padding: 5px; border: 0px solid; border-color: #FF0000; width: 980px;">
    <div style="width:100%; margin-bottom: 10px;">
        <div id="dowebok" class="easyui-panel" style="color: #000000; line-height:30px; height:30px; font-size: 15px;">
            &nbsp;
        </div>
    </div>
    <script type="text/javascript">
        $(function ()
        {
            $("#sidebar-bar1").jSitebar({
                text: "返回顶部",
                image: "{$empt_var|getTemplPath}/Public/commimg/arrow-top.png",
                bodyWidth: "1050px",
                bottom: "440px",
                callback: function ()
                {
                    $("html,body").stop(true, true).animate({scrollTop: 0}, 200);
                }
            });

            $("#sidebar-bar2").jSitebar({
                text: "返回上页",
                image: "{$empt_var|getTemplPath}/Public/commimg/arrow-back.png",
                bodyWidth: "1050px",
                bottom: "390px",
                callback: function ()
                {
                    goBack();
                }
            });

            $("#sidebar-bar3").jSitebar({
                text: "返回底部",
                image: "{$empt_var|getTemplPath}/Public/commimg/arrow-down.png",
                bodyWidth: "1050px",
                bottom: "340px",
                callback: function ()
                {
                    $("html,body").stop(true, true).animate({scrollTop: $(document).height()}, 200);
                }
            });
        });
    </script>

    <script type="text/javascript">
        function data_datagrid_fmt_1(value, row, index)
        {
            var abValue = value;
            //if (value.length >= 22)
            //    abValue = value.substring(0, 19) + "...";
            var content = '<div title="' + value + '" class="note">' + abValue + '</div>';
            return content;
        }
        function data_datagrid_fmt_2(value, row, index)
        {
            var content = ""
            content += '<a href="javascript:void(0)" title="技术协议->预览" onclick="data_preview(this)">预览</a>';
            content += ' ';
            content += '<a href="javascript:void(0)" title="技术协议->打包下载" onclick="data_packdown(this)">下载</a>';
            return content;
        }

        function data_preview(target)
        {
            var row_index = getRowIndex(target);
            var row_id = $("#data_datagrid").datagrid('getRows')[row_index].id;

            //载入预览
            //if (g_jsxyyl_row_index != row_id)
            //{
            g_jsxyyl_row_index = row_id;
            load_ht_fp_pic(g_jsxyyl_row_index, "jsxy", "jsxyyl");
            //}

            //显示预览
            for (var key in g_viewer_list)
            {
                var flStr = g_viewer_list[key].element.id;
                if (flStr.split("_")[1] == "jsxyyl")
                {
                    if ($("#galley_" + "jsxyyl" + "_ul > li").length == 0)
                        $.messager.alert("消息", "暂无技术协议", "info");
                    else
                        g_viewer_list[key].show();
                    break;
                }
            }
        }

        function data_packdown(target)
        {
            var row_index = getRowIndex(target);
            var row_id = $("#data_datagrid").datagrid('getRows')[row_index].id;
            downloadAllPic(row_id, "jsxy")
        }

        function downloadAllPic(row_id, fl)
        {
            if (row_id == -1)
                row_id = g_gclb_row_index;

            $.ajax({
                type: "POST",
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/downloadAllPic",
                data: {id: row_id, fl: fl},
                async: false,
                success: function (data_obj)
                {
                    if (data_obj.filecount == 0)
                    {
                        $.messager.alert("消息", "暂无下载内容", "info");
                    }
                    else
                    {
                        var $form = $('<form method="GET"></form>');
                        $form.attr('action', data_obj.filename);
                        $form.appendTo($('body'));
                        $form.submit();
                    }
                }
            });
        }
    </script>

    <script type="text/javascript">
        $(function ()
        {
            $('#data_datagrid_combobox_fl').combobox({
                onChange: function (newValue, oldValue)
                {
                    reLoad();
                }
            });
        });
    </script>

    <table id="data_datagrid"
           class="easyui-datagrid" style="width: 100%; height: 680px;"
           url="{:APP_ROOT}{:DEF_MODULE}/Gclb/listData"
           title=""
           toolbar="#user_list_tb_1" footer=""
           singleSelect="true" fitColumns="false" rownumbers="true"
           pageList="[100]" pageSize="100" pagination="true">
        <thead>
        <tr>
            <th field="gc_mc" width="150">工程名称</th>
            <th field="dw_mc" width="150">单位名称</th>
            <th field="gq" width="70">工期（天）</th>
            <th field="htks_rq" width="80">合同开始日期</th>
            <th field="htjh_rq" width="80">合同交货日期</th>
            <th field="yqzr" formatter="data_datagrid_fmt_1" width="65">延期责任</th>
            <th field="gc_jd" formatter="data_datagrid_fmt_1" width="260">工程进度</th>
            <th field="action" formatter="data_datagrid_fmt_2" width="80" align="center">技术协议</th>
        </tr>
        </thead>
    </table>

    <div id="galley_jsxyyl" style="display: none; width: 50px;">
        <ul id="galley_jsxyyl_ul" class="pictures">
        </ul>
    </div>

    <div id="user_list_tb_1" style="padding:5px; height:auto">
        <div>
            <!--<in name="id" value="1,2,3"></in>-->
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newData()">添加</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="updateData()">编辑</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="delData()">删除</a>

            <span style="height: 10px; line-height: 10px; border-left: 1px solid LightGrey; margin-left: 1px; margin-right: 10px;"></span>
            <!--<input class="easyui-combobox" style="width:100px" url="/combobox_data.json" valueField="id" textField="text">-->
            <select id="data_datagrid_combobox_fl" class="easyui-combobox" editable="false" panelHeight="115">
                <option value="all" selected>全部</option>
                <option value="wts">未调试</option>
                <option value="wys">未验收</option>
                <option value="ts">已调试</option>
                <option value="ys">已验收</option>
            </select>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" onclick="reLoad()">刷新</a>
        </div>
        <!--查找工具栏-->
        <!--<div style="margin-top:5px">-->
        <!--日期: <input class="easyui-datebox" style="width:100px">&nbsp;-->
        <!--至: <input class="easyui-datebox" style="width:100px">&nbsp;-->
        <!--用户:<input class="easyui-combobox" style="width:100px" url="/combobox_data.json" valueField="id" textField="text">-->
        <!--&nbsp;-->
        <!--<a href="#" class="easyui-linkbutton" iconCls="icon-search">查找</a>-->
        <!--</div>-->
    </div>

    <!--<div id="user_list_ft_1" style="padding: 2px 5px; display: none;">-->
    <!--<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true"></a>-->
    <!--<a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true"></a>-->
    <!--<a href="#" class="easyui-linkbutton" iconCls="icon-save" plain="true"></a>-->
    <!--<a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true"></a>-->
    <!--<a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true"></a>-->
    <!--<div class="pagination-info">共20记录</div>-->
    <!--</div>-->

    <!--==================================================-->
    <div id="modifydata_dlg" class="easyui-dialog" style="width:500px" modal="true" closed="true" buttons="#modifydata_dlg-buttons">
        <form id="modifydata_fm" method="post" style="margin:0;padding:20px 50px">
            <input type="hidden" id="id" name="id" value=""/>

            <div id="modifydata_dispanel" style="margin-bottom: 20px; font-size: 12px; border-bottom: 1px solid #ccc;"></div>

            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="gc_mc" name="gc_mc" class="easyui-textbox" label="工程名称:" labelWidth="100" style="width:100%">
            </div>
            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="dw_mc" name="dw_mc" class="easyui-textbox" label="单位名称:" labelWidth="100" style="width:100%">
            </div>
            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="gq" name="gq" class="easyui-numberbox" label="工期（天）:" labelWidth="100" style="width:100%">
            </div>
            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="htks_rq" name="htks_rq" class="easyui-datebox" label="合同开始日期:" labelWidth="100" style="width:100%">
            </div>
            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="htjh_rq" name="htjh_rq" class="easyui-datebox" label="合同交货日期:" labelWidth="100" style="width:100%">
            </div>
            <div style="margin-bottom: 10px">
                <input id="yqzr" name="yqzr" class="easyui-textbox" data-options="multiline:true" label="延期责任:" labelWidth="100" style="height:30px;width:100%">
            </div>
            <div style="margin-bottom: 10px">
                <input id="gc_jd" name="gc_jd" class="easyui-textbox" data-options="multiline:true" label="工程进度:" labelWidth="100" style="height:100px;width:100%">
            </div>
        </form>
    </div>
    <div id="modifydata_dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveData()" style="width: 90px">确定</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#modifydata_dlg').dialog('close')" style="width: 90px">取消</a>
    </div>

    <!--==================================================-->
    <script type="text/javascript">
        $(function ()
        {
            $("input", $("#user_name,#password").next("span")).keydown(function (e)
            {
                var keynum;
                keynum = window.event ? e.keyCode : e.which;
                if (keynum == 13)
                    login_pro();
            });
        });
    </script>

    <div id="login_dlg" class="easyui-dialog" style="width:260px" modal="true" closed="true" buttons="#login_dlg-buttons">
        <form id="login_fm" method="post" style="margin:0;padding:20px 20px">
            <div id="login_dispanel" style="margin-bottom: 20px; font-size: 12px; border-bottom: 1px solid #ccc;"></div>

            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="user_name" name="user_name" class="easyui-textbox" label="用户名:" labelWidth="50" style="width:100%">
            </div>
            <div class="easyui-tooltip" style="margin-bottom: 10px">
                <input id="password" name="password" class="easyui-passwordbox" label="密码:" labelWidth="50" style="width:100%">
            </div>
        </form>
    </div>
    <div id="login_dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="login_pro()" style="width: 90px">确定</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#login_dlg').dialog('close')" style="width: 90px">取消</a>
    </div>

    <div id="manage_notice_dlg" class="easyui-dialog" style="width:750px" modal="true" closed="true" buttons="#manage_notice_dlg-buttons">
        <form id="manage_notice_fm" method="post" style="margin:0;padding:20px 20px">
            <div id="manage_notice_dispanel" style="margin-bottom: 20px; font-size: 12px; border-bottom: 1px solid #ccc;">
                交流信息内容:
            </div>
            <input id="notice_text" name="notice_text" class="easyui-textbox" labelWidth="50" data-options="multiline:true" style="height:500px; width:100%;">
        </form>
    </div>
    <div id="manage_notice_dlg-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="save_notice()" style="width: 90px">确定</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#manage_notice_dlg').dialog('close')" style="width: 90px">取消</a>
    </div>

</div>

<div id="sidebar-bar1" class="jsitebar-orange" style="display: none;"></div>
<div id="sidebar-bar2" class="jsitebar-orange" style="display: none;"></div>
<div id="sidebar-bar3" class="jsitebar-orange" style="display: none;"></div>

</body>

<footer>
    <script type="text/javascript" src="{$empt_var|getTemplPath}/Public/viewerjs/viewer.js"></script>

    <script type="text/javascript">
        var g_sp_tab_array = [
            {fl: "jsxy", fl_str: "技术协议", load_flag: 0},
            {fl: "fhd", fl_str: "发货单", load_flag: 0},
            {fl: "tsk", fl_str: "调试服务卡", load_flag: 0},
            {fl: "qt", fl_str: "其它", load_flag: 0}
        ];
    </script>

    <if condition="($gc_manage_auth eq 1) or ($gccg_manage_auth eq 1)">
        <script type="text/javascript">
            g_sp_tab_array.unshift({fl: "ht", fl_str: "商务合同", load_flag: 0});
        </script>
    </if>

    <script type="text/javascript">
        $(function ()
        {
            //Tabs页面生成
            var tepl_content_str = $("#sp_tpl").html();
            $("#sp_tpl").empty();
            for (var key in g_sp_tab_array)
            {
                var fl = g_sp_tab_array[key].fl;
                var fl_str = g_sp_tab_array[key].fl_str;
                var content_str = tepl_content_str;
                content_str = content_str.replace(new RegExp("'ht'", "gm"), "'" + fl + "'");
                content_str = content_str.replace(new RegExp("_ht", "gm"), "_" + fl);

                $("#sp_tabs").tabs("add", {
                    title: fl_str,
                    content: content_str
                });

                g_viewer_list[key] = new Viewer(document.getElementById("galley_" + fl), {url: "data-original"});
            }

            //技术协议预览
            g_viewer_list.push(new Viewer(document.getElementById("galley_" + "jsxyyl"), {url: "data-original"}));

            //载入扫描图片
            $("#sp_tabs").tabs({
                onSelect: function (title, index)
                {
                    if (g_sp_tab_array[index].load_flag == 0)
                    {
                        g_sp_tab_array[index].load_flag = 1;
                        load_ht_fp_pic(g_gclb_row_index, g_sp_tab_array[index].fl, g_sp_tab_array[index].fl);
                    }
                }
            });

            //Tabs高度修正
            $("#sp_tabs .tabs-panels").height($("#sp_tabs").height() - 31);
            $("#gcqk_tabs .tabs-panels").height($("#sp_tabs").height() - 31);

            //显示公告
            setInterval(function ()
            {
                if ($("#gc_main").is(':visible'))
                    dis_notice();
            }, 60 * 1000 * 10);
            dis_notice();
        });

        function dis_notice()
        {
            var notice_obj = get_notice(1);

            g_$notice_info = notice_obj.notice;
            $("#dowebok").html(g_$notice_info);

            $("#dowebok").liMarquee({
                runshort: false,
                scrollamount: 35,
                direction: "left"
            });

            $("#top_dis_panel_3").html("：" + notice_obj.notice_update_datetime + "&nbsp;更新");
        }
    </script>

    <script type="text/javascript">
        //--------------------------------------------------
        $("#data_datagrid").datagrid({
            onLoadSuccess: function (data)
            {
                $("#data_datagrid").datagrid("selectRow", 0);
            }
        });

        //--------------------------------------------------
        var tip_str_1 = "该项必须输入";
        $(".easyui-tooltip").tooltip({
            position: "right",
            content: '<span style="color:#000000">' + tip_str_1 + '</span>',
            onShow: function ()
            {
                $(this).tooltip("tip").css({
                    backgroundColor: "#FFFFCF",
                    borderColor: "#D09C36"
                });
            }
        });

        //--------------------------------------------------
        $(function ()
        {
            /*
             $("input", $("#user_name,#dis_name").next("span")).keydown(function (e)
             {
             name_ary = $(this).next().eq(0).attr("name").split("_");
             $("#" + name_ary[0] + "_" + name_ary[1] + "_" + "disinfo").tooltip({content: '<span style="color:#000000">' + tip_str_1 + '</span>'});
             });
             */
        })
    </script>

    <script type="text/javascript">
        function newData()
        {
            $("#modifydata_dlg").form("clear");
            $("#id").val(-1);
            $("#modifydata_dispanel").html("添加" + "工程信息");
            $("#modifydata_dlg").dialog("open").dialog("center").dialog("setTitle", "添加" + "");
            $('#gh_mc').next('span').find('input').focus();
        }

        function updateData()
        {
            var row = $("#data_datagrid").datagrid("getSelected");
            if (row == null)
            {
                $.messager.alert("消息", "请选中要编辑的条目", "info");
                return;
            }

            $("#modifydata_dlg").form("clear");
            $("#id").val(row.id);
            var fieldList = ["gc_mc", "dw_mc", "gq", "htks_rq", "htjh_rq", "yqzr", "gc_jd"];
            for (var i = 0; i < fieldList.length; i++)
                $("#" + fieldList[i]).textbox("setValue", row[fieldList[i]]);

            $("#modifydata_dispanel").html("编辑" + "工程信息");
            $("#modifydata_dlg").dialog("open").dialog("center").dialog("setTitle", "编辑" + "");
            $('#gc_mc').next('span').find('input').focus();
        }

        function saveData()
        {
            if ($("#id").val() == -1)
                proUrlStr = "addData";
            if ($("#id").val() > -1)
                proUrlStr = "updateData";

            $('#modifydata_fm').form("submit", {
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/" + proUrlStr,
                onSubmit: function ()
                {
                    //客户端校验
                    return true;
                },
                success: function (result)
                {
                    //服务端校验
                    data_obj = eval("(" + result + ")");

                    if (data_obj.error == 1)
                    {
                        $.messager.alert("消息", data_obj["infoAry"], "warning");
                    }
                    else
                    {
                        //添加
                        if ($("#id").val() == -1)
                        {
                            $("#data_datagrid").datagrid("insertRow", {index: 0, row: data_obj.infoAry});
                            $("#data_datagrid").datagrid("selectRow", 0);
                        }

                        //编辑
                        if ($("#id").val() > -1)
                        {
                            var row = $("#data_datagrid").datagrid("getSelected");
                            var rowIndex = $('#data_datagrid').datagrid('getRowIndex', row);

                            for (var key in data_obj.infoAry)
                                row[key] = data_obj.infoAry[key];
                            $('#data_datagrid').datagrid('refreshRow', rowIndex);
                        }

                        $("#modifydata_dlg").dialog("close");
                    }
                }
            });
        }

        function delData()
        {
            var row = $("#data_datagrid").datagrid("getSelected");
            if (row == null)
            {
                $.messager.alert("消息", "请选中要删除的工程", "info");
                return;
            }

            if (row)
            {
                $.messager.confirm("提示", "是否要删除选中工程?", function (r)
                {
                    if (r)
                    {
                        var tran_ary = {}
                        tran_ary["id"] = row.id;

                        $.ajax({
                            type: "POST",
                            url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/delData",
                            data: tran_ary,
                            // data: {id: row.id},
                            success: function (data_obj)
                            {
                                var rowIndex = $("#data_datagrid").datagrid("getRowIndex", row);
                                $("#data_datagrid").datagrid("deleteRow", rowIndex);
                            }
                        });
                    }
                });
            }
        }

        function reLoad()
        {
            $("#data_datagrid").datagrid("load",
                    {
                        filter_fl: $("#data_datagrid_combobox_fl").combobox('getValue')
                    });
        }
    </script>

    <script type="text/javascript">
        //--------------------------------------------------
        function goBack()
        {
            $("#gc_main").show();
            $("#gc_detail").hide();

            $("#sidebar-bar1").hide();
            $("#sidebar-bar2").hide();
            $("#sidebar-bar3").hide();

            $("#top_dis_panel_1").show();
            $("#top_dis_panel_2").show();
            $("#top_dis_panel_3").show();
            $("#top_dis_panel_gcname").hide();
        }

        //--------------------------------------------------
        function updateFile(fl, upfile, subName, saveName, fileName)
        {
            var formData = new FormData();
            formData.append("file", upfile);
            formData.append("fl", fl);
            formData.append("subName", subName);    //"2018/10"
            formData.append("saveName", saveName);  //"23_ht_00001" , "23_fp_00001"
            formData.append("fileName", fileName);  //"图像.jpg"

            $.ajax({
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/updateFile",
                type: 'POST',
                data: formData,
                async: false,
                processData: false,   // 设置jQuery不要处理发送的数据
                contentType: false,   // 设置jQuery不要设置Content-Type请求头
                beforeSend: function ()
                {
                    //console.log("正在进行，请稍候");
                },
                success: function (responseStr)
                {
                    //console.log(responseStr);
                },
                error: function (responseStr)
                {
                    //console.log(responseStr);
                }
            });
        }

        function updateFileFront(fl)
        {
            if (g_gclb_row_index == 0 || g_cr_data == "")
                return;

            var flStr = fl;

            //--------------------------------------------------
            var maxPicIndex = 0;
            $.ajax({
                type: "POST",
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/getHtPicMaxIndex",
                data: {id: g_gclb_row_index, fl: flStr},
                async: false,
                success: function (data_obj)
                {
                    maxPicIndex = data_obj.maxPicIndex;
                }
            });

            //--------------------------------------------------
            //按文件名排序
            var select_file = document.getElementById("select_files_" + flStr).files;
            if (select_file.length == 0)
                return;

            var fileList = [];
            for (var i = 0; i < select_file.length; i++)
            {
                fileList.push({name: select_file[i].name, file: select_file[i]});
            }
            fileList = fileList.sort(
                    function (a, b)
                    {
                        if (a.name < b.name) return -1;
                        if (a.name > b.name) return 1;
                        return 0;
                    }
            );

            //--------------------------------------------------
            //上传
            for (i = 0; i < fileList.length; i++)
            {
                var subName = g_cr_data.split("-")[0] + "/" + g_cr_data.split("-")[1];
                var saveName = g_gclb_row_index.toString() + "_" + flStr + "_" + (Array(5).join(0) + (maxPicIndex + (i + 1))).slice(-5);

                updateFile(fl, fileList[i].file, subName, saveName, fileList[i].name);  //"2018/10" => "23_ht_00001" , "23_fp_00001" , "图像.jpg"
            }

            //--------------------------------------------------
            //刷新显示
            if (fl.toLowerCase() == "gcsj")
                $("#datagrid_gcwj").datagrid("reload");
            else
            {
                load_ht_fp_pic(g_gclb_row_index, fl, fl);
            }

            //--------------------------------------------------
            //清除选择文件
            $("#select_files_" + flStr).val("");
            $.messager.alert("消息", "上传完成", "info");
        }

        function updateGcJc(fl)
        {
            //车间生产情况
            var text_val = "";
            if (fl == 1)
                text_val = $("#sj_qk").textbox("getValue");
            if (fl == 2)
                text_val = $("#cg_qk").textbox("getValue");
            if (fl == 3)
                text_val = $("#cj_qk").textbox("getValue");

            $.ajax({
                type: "POST",
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/updateGcJc",
                data: {id: g_gclb_row_index, fl: fl, data: text_val},
                async: false,
                success: function (data_obj)
                {
                }
            });
        }

        //--------------------------------------------------
        function load_ht_fp_pic(row_id, fl, dis_fl)
        {
            $.ajax({
                type: "POST",
                url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/getHtPic",
                data: {id: row_id, fl: fl},
                async: false,
                success: function (data_obj)
                {
                    //g_cr_data = data_obj.cr_data;
                    var yhStr = String.fromCharCode(34);

                    $("#galley_" + dis_fl + "_ul").html("");
                    for (var i = 0; i < data_obj.ht.length; i++)
                    {
                        var htPath = data_obj.ht[i];
                        $("#galley_" + dis_fl + "_ul").append(
                                "<li>" +
                                "<div style='display: none; text-align: center;'>" +
                                "<a href='javascript:void(0)' style='font-size: 14px;font-weight: 600; text-decoration: none;' onclick='delHtPic(this)'>删除</a>" +
                                "<input type='hidden' value=" + yhStr + htPath + yhStr + ">" +
                                "</div>" +
                                "<img " +
                                "data-original=" + yhStr + htPath + "?t=" + Math.random() + yhStr + " " +
                                "src=" + yhStr + htPath + "?t=" + Math.random() + yhStr + " " +
                                "alt=" + yhStr + "图片" + yhStr + " " +
                                "/>" +
                                "</li>");
                    }
                    $("#galley_" + dis_fl + "_panel").panel('resize', {
                        width: 946,
                        height: 322
                        //height: data_obj.ht.length > 4 ? 322 : 304
                    });

                    //刷新控件
                    for (var key in g_viewer_list)
                    {
                        var flStr = g_viewer_list[key].element.id;
                        if (flStr.split("_")[1] == dis_fl)
                        {
                            g_viewer_list[key].destroy();
                            g_viewer_list[key] = new Viewer(document.getElementById('galley_' + dis_fl), {url: 'data-original'});
                            break;
                        }
                    }
                }
            });
        }

        function delGcFile()
        {
            var row = $("#datagrid_gcwj").datagrid("getSelected");
            if (row == null)
            {
                $.messager.alert("消息", "请选中要删除的文件", "info");
                return;
            }

            if (row)
            {
                $.messager.confirm("提示", "是否要删除选中文件?", function (r)
                {
                    if (r)
                    {
                        var delFile = row.file;
                        $.ajax({
                            type: "POST",
                            url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/delMFile",
                            data: {delFile: delFile},
                            success: function (data_obj)
                            {
                            }
                        });

                        var rowIndex = $("#datagrid_gcwj").datagrid("getRowIndex", row);
                        $("#datagrid_gcwj").datagrid("deleteRow", rowIndex);
                    }
                });
            }

        }

        function delHtPic(selfobj)
        {
            $.messager.confirm('提示', '是否要删除此张图片?', function (r)
            {
                if (r)
                {
                    var delFile = $(selfobj).next("input").val();
                    $.ajax({
                        type: "POST",
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/delMFile",
                        data: {delFile: delFile},
                        success: function (data_obj)
                        {
                        }
                    });

                    $(selfobj).parent().parent("li").remove();
                }
            });
        }

        function delAllPic(fl)
        {
            $.messager.confirm('提示', '是否要清空所有图片?', function (r)
            {
                if (r)
                {
                    var delFileList = []
                    $("#galley_" + fl + "_ul").find('li > div > input').each(function ()
                    {
                        delFileList.push($(this).val());
                    });
                    $("#galley_" + fl + "_ul").empty();

                    $.ajax({
                        type: "POST",
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/delHtAllPic",
                        data: {delFileList: delFileList},
                        async: false,
                        success: function (data_obj)
                        {
                        }
                    });
                }
            });
        }
    </script>

    <if condition="$gc_manage_auth eq 0">
        <script type="text/javascript">
            function data_datagrid_toolbar()
            {
                //$('#data_datagrid_jdk').datagrid({toolbar: ''});
            }
            function data_datagrid_col()
            {
                //$('#data_datagrid_jdk').datagrid('hideColumn', 'action')
            }
        </script>
    </if>
    <if condition="$gc_manage_auth eq 1">
        <script type="text/javascript">
            function data_datagrid_toolbar()
            {
            }
            function data_datagrid_col()
            {
            }
        </script>
    </if>

    <if condition="$login_flag eq 0">
        <script type="text/javascript">
            $(function ()
            {
                $("#data_datagrid").datagrid({
                    onDblClickRow: function (index, row)
                    {
                        $.messager.alert("消息", "请登录后查看工程详细信息", "info");
                    }
                });
            })
        </script>
    </if>
    <if condition="$login_flag eq 1">
        <script type="text/javascript">
            $(function ()
            {
                function dis_gc_detail()
                {
                    //--------------------------------------------------
                    $('#gc_detail_propertygrid').datagrid({
                        title: '信息列表',
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/col_dis_gc_detail",
                        queryParams: {id: g_gclb_row_index},
                        showHeader: false,
                        showGroup: false,
                        scrollbarSize: 0,
                        columns: [[
                            {field: 'name', title: '项目', width: 35, sortable: false},
                            {field: 'value', title: '值', width: 65, resizable: false}
                        ]],
                        onAfterEdit: function (index, row)
                        {
                            //自动保存
                            saveGcDetailData(0);
                        }
                    });
                    //备注
                    $.ajax({
                        type: "POST",
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/col_dis_gc_detail",
                        data: {id: g_gclb_row_index},
                        async: false,
                        success: function (data_obj)
                        {
                            $("#bz").textbox("setValue", data_obj.rows[0]["bz"]);
                        }
                    });

                    //--------------------------------------------------
                    $('#datagrid_fkfs').datagrid({
                        title: "付款方式",
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/col_dis_gc_kffs",
                        queryParams: {id: g_gclb_row_index},
                        async: false,
                        singleSelect: true, fitColumns: false, rownumbers: false,
                        pageList: [100], pageSize: "100", pagination: false,
                        columns: [
                            [
                                {
                                    field: 'kx',
                                    title: '款项',
                                    width: 100,
                                },
                                {
                                    field: 'fk_bl',
                                    title: '付款比例',
                                    width: 150,
                                    editor: {type: 'text', options: {}}
                                },
                                {
                                    field: 'fk_je',
                                    title: '付款金额（万）',
                                    width: 150,
                                    editor: {type: 'numberbox', options: {min: 0, precision: 2}}
                                },
                                {
                                    field: 'action', title: '操作', width: 80, align: 'center',
                                    formatter: function (value, row, index)
                                    {
                                        if (row.editing)
                                        {
                                            var s = '<a href="javascript:void(0)" onclick="saverow(this, \'datagrid_fkfs\', \'\')">保存</a> ';
                                            var c = '<a href="javascript:void(0)" onclick="cancelrow(this, \'datagrid_fkfs\')">取消</a>';
                                            return s + c;
                                        }
                                        else
                                        {
                                            var e = '<a href="javascript:void(0)" onclick="editrow(this, \'datagrid_fkfs\')">编辑</a> ';
                                            var d = '<a href="javascript:void(0)" onclick="deleterow(this, \'datagrid_fkfs\', \'\')">删除</a>';
                                            return e + d;
                                        }
                                    }
                                }
                            ]
                        ],
                        onBeforeEdit: function (index, row)
                        {
                            row.editing = true;
                            $(this).datagrid('refreshRow', index);
                        },
                        onAfterEdit: function (index, row)
                        {
                            row.editing = false;
                            $(this).datagrid('refreshRow', index);
                            saveGcDetailData(0);
                        },
                        onCancelEdit: function (index, row)
                        {
                            row.editing = false;
                            $(this).datagrid('refreshRow', index);
                        },
                        onClickRow: function (index, row)
                        {
                        }
                    });

                    //--------------------------------------------------
                    $('#datagrid_fkjd').datagrid({
                        title: "付款进度" +
                        "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" +
                        '<a href="javascript:void(0)" style="text-decoration: none;" onclick="insertrow(\'datagrid_fkjd\')">添加</a>',
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/getListJdk",
                        queryParams: {pid: g_gclb_row_index},
                        singleSelect: true, fitColumns: false, rownumbers: false,
                        pageList: [100], pageSize: "100", pagination: false,
                        columns: [
                            [
                                {
                                    field: 'kx',
                                    title: '款项',
                                    width: 100,
                                    editor: {type: 'text', options: {}}
                                },
                                {
                                    field: 'fk_rq',
                                    title: '付款日期',
                                    width: 100,
                                    editor: {type: 'datebox', options: {}}
                                },
                                {
                                    field: 'fk_je',
                                    title: '付款金额（万）',
                                    width: 100,
                                    editor: {type: 'numberbox', options: {min: 0, precision: 2}}
                                },
                                {
                                    field: 'fk_fs',
                                    title: '付款方式',
                                    width: 80,
                                    editor: {
                                        type: 'combobox',
                                        options: {
                                            panelHeight: 'auto',
                                            editable: false,
                                            data: [
                                                {'id': '现金', 'text': '现金'},
                                                {'id': '承兑', 'text': '承兑'},
                                                {'id': '承兑贴现', 'text': '承兑贴现'},
                                            ],
                                            valueField: 'id',
                                            textField: 'text'
                                        }
                                    }
                                },
                                {
                                    field: 'bz',
                                    title: '备注',
                                    width: 180,
                                    editor: {type: 'text', options: {}}
                                },
                                {
                                    field: 'action', title: '操作', width: 80, align: 'center',
                                    formatter: function (value, row, index)
                                    {
                                        if (row.editing)
                                        {
                                            var s = '<a href="javascript:void(0)" onclick="saverow(this, \'datagrid_fkjd\', \'/Gclb/updateJdk\')">保存</a> ';
                                            var c = '<a href="javascript:void(0)" onclick="cancelrow(this, \'datagrid_fkjd\')">取消</a>';
                                            return s + c;
                                        }
                                        else
                                        {
                                            var e = '<a href="javascript:void(0)" onclick="editrow(this, \'datagrid_fkjd\')">编辑</a> ';
                                            var d = '<a href="javascript:void(0)" onclick="deleterow(this, \'datagrid_fkjd\', \'/Gclb/delJdk\')">删除</a>';
                                            return e + d;
                                        }
                                    }
                                }
                            ]
                        ],
                        onBeforeEdit: function (index, row)
                        {
                            row.editing = true;
                            $(this).datagrid('refreshRow', index);
                        },
                        onAfterEdit: function (index, row)
                        {
                            row.editing = false;
                            $(this).datagrid('refreshRow', index);
                        },
                        onCancelEdit: function (index, row)
                        {
                            row.editing = false;
                            $(this).datagrid('refreshRow', index);
                        },
                        onClickRow: function (index, row)
                        {
                        }
                    });

                }

                //--------------------------------------------------
                function dis_gc_jc()
                {
                    $.ajax({
                        type: "POST",
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/getGcJc",
                        data: {id: g_gclb_row_index},
                        async: false,
                        success: function (data_obj)
                        {
                            $("#sj_qk").textbox("setValue", data_obj.data.sj_qk);
                            $("#cg_qk").textbox("setValue", data_obj.data.cg_qk);
                            $("#cj_qk").textbox("setValue", data_obj.data.cj_qk);
                        }
                    });

                    //--------------------------------------------------
                    $('#datagrid_gcwj').datagrid({
                        url: "{:APP_ROOT}{:DEF_MODULE}/Gclb/getListGcFile",
                        queryParams: {id: g_gclb_row_index},
                        singleSelect: true, fitColumns: false, rownumbers: false,
                        pageList: [10000], pageSize: "10000", pagination: false,
                        columns: [
                            [
                                {
                                    field: 'file',
                                    title: '文件',
                                    width: 260,
                                    formatter: function (value, row, index)
                                    {
                                        //编码URL传输特殊字符
                                        var temp_arr = value.split("/");
                                        temp_arr[temp_arr.length - 1] = encodeURIComponent(temp_arr[temp_arr.length - 1]);
                                        var href_val = temp_arr.join("/")

                                        var spstr_1 = row.file_spstr_1;
                                        var fileName = value.split("/").pop().split(spstr_1)[1];
                                        var e = '<a href="' + href_val + '" download="' + fileName + '">' + fileName + '</a> ';
                                        return e;
                                    }
                                },
                            ]
                        ]
                    });
                }

                //--------------------------------------------------
                $("#data_datagrid").datagrid({
                    onDblClickRow: function (index, row)
                    {
                        //顶部显示
                        $("#top_dis_panel_1").hide();
                        $("#top_dis_panel_2").hide();
                        $("#top_dis_panel_3").hide();
                        $("#top_dis_panel_gcname").show();

                        $("#top_dis_panel_gcname").text(row.gc_mc);

                        //刷新显示
                        $("#gc_main").hide();
                        $("#gc_detail").show();

                        g_gclb_row_index = row.id;
                        g_cr_data = row.cr_data;

                        $("#sidebar-bar1").show();
                        $("#sidebar-bar2").show();
                        $("#sidebar-bar3").show();

                        //--------------------------------------------------
                        //载入工程明细
                        dis_gc_detail();

                        //--------------------------------------------------
                        //载入工程状态文本
                        dis_gc_jc();

                        //--------------------------------------------------
                        //选中标签
                        if ($('#sp_tabs').tabs("tabs").length >= 5)
                            $('#sp_tabs').tabs('select', "商务合同");
                        else
                            $('#sp_tabs').tabs('select', "技术协议");
                        $('#gcqk_tabs').tabs('select', "工程设计情况");

                        //初始化状态
                        for (var key in g_sp_tab_array)
                        {
                            g_sp_tab_array[key].load_flag = 0;
                            var flStr = g_sp_tab_array[key].fl;

                            $("#dis_panel_" + flStr + "_del").text("删除");
                            $("#dis_panel_" + flStr).text("上传");
                            $("#update_file_" + flStr).hide();
                        }
                        if ($("#dis_panel_gcsj").length > 0)
                        {
                            $("#dis_panel_gcsj").text("上传");
                            $("#update_file_gcsj").hide();
                            $("#gcsj_qk_panel").panel({width: 671, height: 322});
                        }

                        //载入扫描图片
                        g_sp_tab_array[0].load_flag = 1;
                        load_ht_fp_pic(g_gclb_row_index, g_sp_tab_array[0].fl, g_sp_tab_array[0].fl);

                        //--------------------------------------------------
                        //工具栏、显示列控制
                        data_datagrid_toolbar();
                        data_datagrid_col()
                    }
                });
            })
        </script>
    </if>

    <script type="text/javascript">
        function getRowIndex(target)
        {
            var tr = $(target).closest('tr.datagrid-row');
            return parseInt(tr.attr('datagrid-row-index'));
        }

        function insertrow(datagrid_name)
        {
            $("#" + datagrid_name).datagrid('appendRow',
                    {
                        id: "-1",
                        pid: g_gclb_row_index,
                        fk_rq: getNowFormatDate()
                    }
            );

            append_index = $("#" + datagrid_name).datagrid('getRows').length - 1;
            $("#" + datagrid_name).datagrid('selectRow', append_index);
            $("#" + datagrid_name).datagrid('beginEdit', append_index);
        }

        function editrow(target, datagrid_name)
        {
            //data_datagrid_jdk
            var row_index = getRowIndex(target);
            $("#" + datagrid_name).datagrid("selectRow", row_index);
            $("#" + datagrid_name).datagrid('beginEdit', row_index);
        }

        function deleterow(target, datagrid_name, url_name)
        {
            $.messager.confirm('提示', '是否要删除此数据条目?', function (r)
            {
                if (r == true)
                {
                    var row_index = getRowIndex(target);
                    $("#" + datagrid_name).datagrid('endEdit', row_index);
                    $("#" + datagrid_name).datagrid("selectRow", row_index);
                    var row = $("#" + datagrid_name).datagrid("getSelected");

                    if (url_name.length > 0)
                    {
                        $.ajax({
                            type: "POST",
                            url: "{:APP_ROOT}{:DEF_MODULE}" + url_name,
                            data: {row: row},
                            async: false,
                            success: function (data_obj)
                            {
                                //console.log(data_obj);
                                $("#" + datagrid_name).datagrid("deleteRow", row_index);
                            }
                        });
                    }
                }
            });
        }

        function saverow(target, datagrid_name, url_name)
        {
            var row_index = getRowIndex(target);
            $("#" + datagrid_name).datagrid('endEdit', row_index);
            $("#" + datagrid_name).datagrid("selectRow", row_index);
            var row = $("#" + datagrid_name).datagrid("getSelected");

            if (url_name.length > 0)
            {
                $.ajax({
                    type: "POST",
                    url: "{:APP_ROOT}{:DEF_MODULE}" + url_name,
                    data: {row: row},
                    async: false,
                    success: function (data_obj)
                    {
                        if (row.id == -1)
                        {
                            row["id"] = data_obj["id"];
                            $("#" + datagrid_name).datagrid('refreshRow', row_index);
                        }
                    }
                });
            }
        }

        function cancelrow(target, datagrid_name)
        {
            $("#" + datagrid_name).datagrid('cancelEdit', getRowIndex(target));
        }
    </script>

    <if condition="$gc_manage_auth eq 0">
        <script type="text/javascript">
            $('#data_datagrid').datagrid({toolbar: ''});
        </script>
    </if>
</footer>

</html>
